package com.tzy.note.base.thread;

import org.junit.jupiter.api.Test;

public class ThreadTest implements Runnable {

    @Override
    public void run() {
        System.out.println("当前线程：" + Thread.currentThread().getName());
    }

    @Test
    public void testThread(){
//        ThreadTest threadTest = new ThreadTest();
//        new Thread(threadTest).start();

        new Thread(){
            @Override
            public void run() {
                super.run();
                System.out.println("当前线程：" + Thread.currentThread().getName());
            }
        }.start();

        new Thread(new Runnable(){
            @Override
            public void run() {
                System.out.println("当前线程：" + Thread.currentThread().getName());
            }
        }).start();

        new Thread(()->{
            System.out.println("当前线程1：" + Thread.currentThread().getName());
        }).start();
    }


}
